<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="../common.jsp"></jsp:include>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
	<title>登录页面</title>
	<link href="${pageContext.request.contextPath}/Lanai/css/lanai-ui.css" rel="stylesheet" />
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/md5.js"></script>
	<script type="text/javascript">
		// 登录页面的登录按钮键盘事件
	    $(document).keydown(function(event){
	        if(event.keyCode == '13'){
	            $('#loginBtn').click();
	        }
	    });
		// 点击重置按钮将文本框内容置空
		function loginRes(){
			$("#tbx_lock_name").val("");
			$("#tbx_lock_password").val("");
		}
	</script>
</head>

<body style="height: 50%;">
  <div class="lockscreen">
    <div class="lockscreen-wrapper">
      <div class="lockscreen-logo">
          <a href="#"><b>审批流程管理系统</b></a>
      </div>
      <form  class="bs-example bs-example-form" role="form">
            <!--class="form-control"  带样式换行-->
          <div class="input-group">
            <span class="input-group-addon" style="background-color: #d2d6de;">用户名：</span>
            <input id="tbx_lock_name" type="text" class="form-control"  placeholder="请输入用户名">
          </div>
          <br/>
          <div class="input-group">
            <span class="input-group-addon" style="background-color: #d2d6de;">密&nbsp;&nbsp;&nbsp;码：</span>
            <input id="tbx_lock_password" type="password" class="form-control"  placeholder="请输入密码">
          </div>
          <div id="nameerr" style="color: red; margin-left: 90px; margin-top: 15px;margin-bottom: 10px; ">
		  </div>
          <br/>
      </form>
      
      <div class="help-block text-center">
        <!--点击根据data-widget关闭modal -->
        <button type="button" id="loginBtn" class="btn" data-placement="top" onclick="pageGodEntry()" style="background-color: white; margin-left:80px; width: 120px">登录 &nbsp;<i class="fa fa-arrow-right text-muted"></i></button>
        <button type="button" id="loginRes" onclick="loginRes()" class="btn" data-placement="top" style="background-color: white; margin-left: 75px;width: 120px"><i class="fa fa-arrow-left text-muted"></i>重置</button>
        <script type="text/javascript">
            function pageGodEntry() {
                var scode = $("#tbx_lock_name").val();
                var pass = md5($("#tbx_lock_password").val());

                $.ajax({
                    type: "POST",
                    url:"${pageContext.request.contextPath}/login/login.do",
                    data:"scode="+scode+"&pass="+pass,
                    success: function(data) {
                        if (data == 0) {
                            $("#nameerr").show();
                            $("#nameerr").html("用户名或者密码不正确！");
                        }else {
                            location.href = "${pageContext.request.contextPath}/main.do";
                        }
                    }
                });
            }
        </script>
      </div>
      <div class="lockscreen-footer text-center">
          &nbsp;
      </div>
    </div>
  </div>
</body>
</html>
